package com.cskaoyan.gateway.controller.shopping;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.shopping.DeleteOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
 * xdx
 * 2020/12/21
 * 22:35
 */
@RestController
@Slf4j
public class DeleteOrderController {

    @Reference(check = false)
    DeleteOrderService deleteOrderService;

    /**
     * 删除订单
     *
     * @author xdx
     */
    @DeleteMapping("shopping/order/{id}")
    public ResponseData deleteOrder(@PathVariable("id") String orderId) {
        boolean b = deleteOrderService.deleteByOrderId(orderId);
        if (b) {
            return new ResponseUtil().setData("成功");
        } else {
            return new ResponseUtil().setErrorMsg("删除失败-byxdx");
        }
    }
}
